const log = require("../Log")
const user = require("../User")
const order = require("../Order")

log.find({},{_id:0,__v:0}).then(logData=>{
  logData.forEach( async val=>{
    const obj = JSON.parse(val.message.split("携带的数据为")[1]);
    if(val.message.includes( "/order/setUser" ) && obj.type === "Financial"){

      const userData = await user.find( { uId: obj.uId } );
      const orderData = await order.find( { oId: obj.oId } );

      console.log(val.message.replace("/order/setUser", "修改订单人员功能").replace("Financial", "财务员").replace(obj.uId, userData[0].employeesName).replace(obj.oId, orderData[0]?.AccountingNo));
    }
  })
})
// Marketer: String,           // 市场员
// OrderClerk: String,         // 订单员
// Quoter: String,             // 报价员
// Purchasing: String,         // 采购员
// Warehouse: String,          // 仓库员
// ProvideBoat: String,        // 供船员
// Financial: String,          // 财务员
// Logistics: String,          // 物流员